package com.sv.domain;

import org.springframework.stereotype.Component;

import com.sv.model.UserInfo;
import com.sv.model.UserInfoCriteria;
@Component
public class User extends UserInfo<User, UserInfoCriteria>{

    public User selectUserByUserId(int userId){
        setUserId(userId);
        return selectByPrimaryKey();
    }
    
    public User selectUserByLogonUserName(String logonUserName){
        UserInfoCriteria criteria = new UserInfoCriteria();
        criteria.createCriteria().andLogonUserNameEqualTo(logonUserName);
        
        return selectFirstByExample(criteria);
    }
    
    public void addUser(){
        User user = new User();
        user.setAge(10);
        user.setEmail("yansu_h@yahoo.cn");
        user.setGender("0");
        user.setLogonUserName("huyuehan");
        user.setName("胡跃瀚");

        user.setPassword("19860619");
        
        insert();
    }
    
}
